package com.liruo.enumconverter.core.jackson;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.liruo.enumconverter.model.SourceEnum;

import java.util.Set;


/**
 * @Author:liruo
 * @Date:2023-02-25-15:24:13
 * @Desc
 */
public class SourceEnumModule extends SimpleModule {
    public SourceEnumModule() {
        super("enumConverterModule",
                new Version(0,0,1,
                        "dev",
                        "com.liruo.enumconverter", "enum-converter-core"));
    }
    public void addSourceEnumImpls(Set<Class<SourceEnum<?>>> sourceEnumImpl,
                                   SourceEnumJackDeserializer deserializer,
                                   SourceEnumJackSerializer serializer){
        sourceEnumImpl.forEach(sourceEnumImplClass ->
                this.addDeserializer(sourceEnumImplClass, deserializer)
                    .addSerializer(sourceEnumImplClass, serializer)

        );
    }
}
